home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
tools
/
czesc_1
/
cpdist
/
filecopy.h
< prev
next >
Wrap
C/C++ Source or Header
|
1994-01-12
|
2KB
|
64 lines
/*
* FILECOPY.H
*
* (c)Copyright 1990,93 by Tobias Ferber, All Rights Reserved.
*/
#ifndef FILECOPY_H
#define FILECOPY_H
#include <stdio.h>
/* increase readability */
typedef unsigned char uchar;
typedef unsigned long ulong;
/*
By default, filecopy() will try to malloc() a copy buffer of
MAXIMUM_BUFFERSIZE bytes. Note that last is limited to 64K
because malloc() can't allocate more at a time by ANSI definition.
There are however situations where you don't want filecopy() to
allocate this buffer on it's own each time. In this case you can
set a permanent copy buffer via fc_setbuf(). If you do so, please
don't forget to free() this buffer again via fc_setbuf(0L) after
having copied all your files.
Note that fc_setbuf will not check wether you try to allocate
more than MAXIMUM_BUFFERSIZE bytes, which makes sense if your
compiler has no limit for malloc() or fc_setbuf() has been patched
to use something else than malloc() to get some memory.
Note also that if filecopy fails to allocate a buffer, it will
copy your file byte for byte.
*/
#define MAXIMUM_BUFFERSIZE (1L<<16)
/*
* The ftell() function in the c.lib of Dillon's shareware C Compiler DICE
* seems to be somewhat buggy. If you've got similar problems with ftell()
* you can comment out the following
#define BUGGY_FTELL
* or simply compile using the -DBUGGY_FTELL option with the result that
* filecopy() will count bytes instead of asking ftell() about the file size.
*/
/* Do my prototypes look like those of Cray Research, Inc. ?! */
#ifndef __
#if defined (__STDC__) || defined(__cplusplus)
#define __(protos) protos
#else /* !(__STDC__ || __cplusplus) */
#define __(protos) ()
#endif /* __STDC__ || __cplusplus */
#endif /* !__ */
extern ulong fc_setbuf __( (ulong numbytes) );
extern long filecopy __( (FILE *src, FILE *dst, long n) );
/* see filecopy.c for further details... */
#endif /* !FILECOPY_H */